package com.cloud.demo.models.bus.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cloud.demo.models.bus.domian.BusOrderHistory;
import com.cloud.demo.models.bus.mapper.BusHistoryMapper;
import com.cloud.demo.models.bus.service.BusHistoryService;
import com.mysql.cj.util.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 *
 */
@Service
@Slf4j
public class BusHistoryServiceImpl extends ServiceImpl<BusHistoryMapper, BusOrderHistory> implements BusHistoryService {

    @Resource
    private BusHistoryMapper busHistoryMapper;

    @Override
    public void insertHistory(BusOrderHistory history, String type) {
        switch (type){
            case "update":insertHis(history,"修改订单");
                break;
            case "insert":insertHis(history,"插入订单");
                break;

        }
    }
    private void insertHis(BusOrderHistory history,String info){
        history.setComment(info);
        int insert = busHistoryMapper.insert(history);
        log.info("order history insert or update count ="+insert);
    }
}




